package yz.mr.Filtration1;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * 对于keyOut可以使用Null，所有的一行数据可以作为valueOut写出，所以对应的是NullWritable，Text
 */
public class FiltrationText1Mapper extends Mapper<LongWritable, Text, NullWritable,Text> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, NullWritable, Text>.Context context) throws IOException, InterruptedException {
        //1500100001	施笑槐,22,女,文科六班,406  这里的一行数据是这样的
        //直接按照 ， 切割
        String[] split = value.toString().split(",");
        int score = Integer.parseInt(split[4]);
        //在对分数进行判断，如果大于就写出
        if (score > 450){
            context.write(NullWritable.get(),value);
        }

    }
}
